<link rel="stylesheet" href="<?php echo APP_TEMPLATES_URL;?>/css/checkbix.min.css" />
<link rel="stylesheet" href="<?php echo APP_TEMPLATES_URL;?>/css/public.css" />
<script src="<?php echo APP_TEMPLATES_URL;?>/js/checkbix.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	Checkbix.init();

	function urluri(thi,number){
		$thii = $(thi);
		var tpstr = $thii.val();
		
		var arr=tpstr.split('\\');//注split可以用字符或字符串分割 
        var filename=arr[arr.length-1];//这就是要取得的图片名称 
		//$("#imgfield").attr("src","images/" + filename);
		$("#imgfield"+number).attr("src","templates/default/images/sfz_03.jpg");
		
	}
</script>

<style>
	body,
	html {
		background: #F4F4F4 !important;
	}
	
	.indexm {
		display: none;
	}
</style>


<?php

if($output['member_info']['member_truename'] && $output['member_info']['member_idcard']) {$is_check = true;} else{
    $is_check = false;  }

?>



<!-- 导航 -->
<div class="mui-bar mui-bar-nav bj">
    <a href="<?php echo urlApp('member','profile'); ?>">
	<button class="mui-btn mui-btn-link mui-btn-nav mui-pull-left zys">
				<img style=" max-width: 50%; vertical-align: middle;" src="<?php echo APP_TEMPLATES_URL;?>/images/back.png" />
			</button></a>
	<h1 class="mui-title"><label style="font-size: 22px;vertical-align: middle;">实名认证</label></h1>
</div>
<ul class="across">
	<li class="side notactive">
		<div class="countone">
			<label>
			
					<input type="text" name="true_name" id="true_name" <?php if($output['member_info']['member_truename']) { ?> disabled="disabled" <?php } ?> value="<?php echo $output['member_info']['member_truename']?>" style="font-size: 14px; width: 100%;vertical-align: middle;border: 0; height: 45px;" placeholder="真实姓名填写" />
					
					
			</label>
			<label style="width: 36px; display: none;"><img style="width: 28px;" src="<?php echo APP_TEMPLATES_URL;?>/images/chacha.png"/></label>
		</div>
		<div style="color: red; border-bottom: 1px  solid;display:none;" id="nameMsg">真实姓名不能空</div>
	</li>

	<li class="side notactive">
		<div class="countone">
			<label>
			
			
			
					<input type="text" id="idcard" name="idcard" <?php if($output['member_info']['member_idcard']) { ?> disabled="disabled" <?php } ?> value="<?php echo $output['member_info']['member_idcard']?>" style="font-size: 14px; width: 100%;vertical-align: middle;border: 0; height: 45px;" placeholder="身份证填写" />
					
					
					
			</label>
			<label style="width: 36px;"><img style="width: 28px; display: none;" src="<?php echo APP_TEMPLATES_URL;?>/images/chacha.png"/></label>
		</div>
		<div style="color: red; border-bottom: 1px  solid;display:none;" id="idcardMsg">身份证不能空</div>
	</li>

</ul>
<div style="clear: both;"></div>


<?php if(false){ ?>
<div style="padding: 20px 15px; font-size: 14px;">
	<p style="font-size: 16px;color: #656565; margin-bottom: 10px;">上传身份证</p>

		<table width="100%">
			<tr>
				<td style="padding: 10px 0;">
					<label for="fileField0">
				    <img style="max-width: 100%;" id="imgfield0" src="<?php echo APP_TEMPLATES_URL;?>/images/siming.jpg" />
			        </label>
					<input type="file" name="fileField" class="file" id="fileField0" size="28" onchange=urluri(this,0); /></td>
				<td style="vertical-align: top;padding: 18px 0 0 20px; color: #979797; min-width: 90px;">
					身份证正面
			    </td>
			</tr>
			
			<tr>
				<td style="padding: 10px 0;">
					<label for="fileField1">
				    <img style="max-width: 100%;" id="imgfield1" src="<?php echo APP_TEMPLATES_URL;?>/images/siming.jpg" />
			        </label>
					<input type="file" name="fileField1" class="file" id="fileField1" size="28" onchange=urluri(this,1); /></td>
				<td style="vertical-align: top;padding: 18px 0 0 20px; color: #979797; min-width: 90px;">
					身份证反面
			    </td>
			</tr>
			
			<tr>
				<td style="padding: 10px 0;">
					<label for="fileField2">
				    <img style="max-width: 100%;" id="imgfield2" src="<?php echo APP_TEMPLATES_URL;?>/images/siming.jpg" />
			        </label>
					<input type="file" name="fileField2" class="file" id="fileField2" size="28" onchange=urluri(this,2); /></td>
				<td style="vertical-align: top;padding: 18px 0 0 20px; color: #979797; min-width: 90px;">
					本人手持身份证正面
			    </td>
			</tr>
		</table>

</div>
<?php }?>

     <input type="hidden" id="member_id" value="<?php echo $output['member_info']['member_id']?>" />
<div style="padding: 15px; clear: both;">
	<table width="100%">
		<tr>
			<td style="padding-bottom: 8px;">
			</td>
		</tr>
		<tr>
			<td style="text-align:center;">
			<?php if(!$is_check){ ?>
			<p style="color: #efb33e;">为保障日后产品回购验证身份，请按要求上传信息</p>
			<p style="color: #efb33e;">（本平台承诺不对外泄露个人信息，请放心填写）</p>
			<?php }else{ ?>
			<p style="color: #47e00b;">身份信息已认证，点击返回按钮返回。</p>
			<?php }?>

				
			</td>
		</tr>
	</table>
</div>
<style>
	.bigbtn{
		position: fixed;
		bottom: 0;
		width: 100%;
		text-align: center;
		color: #000000;
		font-size: 16px;
		background: #f2b743;
		height: 50px;
		line-height: 50px;
		left: 0;
	}
</style>

<?php if(!$is_check){ ?>
<a class="bigbtn submit" href="javascript:;">提交</a>
<?php }else{ ?>
<a href="javascript:;" onclick="history.go(-1)" class="bigbtn">返回</a>
<?php }?>

<style type="text/css">
	.file {
		position: absolute;
		top: 0;
		right: 80px;
		height: 24px;
		filter: alpha(opacity: 0);
		opacity: 0;
		width: 260px
	}
</style>
<script language="javascript">


    $(".submit").click(function(){
       var name = $("#true_name").val();
       var idcard = $("#idcard").val();
       var member_id = $("#member_id").val();

//       if(<?php //echo $is_check; ?>//)  { alert('要修改请联系管理员'); return false;  }


       if(name==''){
           $('#nameMsg').show();
       }else{
         if(idcard==''){
           $("#idcardMsg").show();
         }else{
        	 if(idcard.length!=18){
            	 $("#idcardMsg").html('身份证号不正确').show();
             }else{
               $('#nameMsg').hide();
    		   $("#idcardMsg").html('身份证不能空').hide();
      		 $.ajax({
      			type : "post",
      			url :  "<?php echo APP_SITE_URL;?>/index.php?act=member&op=edittrueidcard",
      			data : {member_id:member_id,idcard:idcard,name:name},
      			dataType : "json",
      			success : function(e) {
      				alert('认证数据已提交');
      				window.location.href ='index.php?act=member&op=profile';
      			}
      		});
         }
       }
     }
   });

</script>
